package com.koi.common.ex.koi;

import com.koi.common.enums.common.IResultEnum;
import lombok.Getter;

/**
 * @author ･ᴗ･
 * @description [新增定义参数异常}
 * RuntimeException 运行时异常，只要报错即不会向下运行
 */
@Getter
public class ParamsException extends RuntimeException {
    private Integer code = 500;
    private String message = "自定义异常，请联系管理员";

    public ParamsException() {
        super("自定义异常，请联系管理员");
    }

    public ParamsException(String message) {
        super(message);
        this.message = message;
    }

    public ParamsException(Integer code) {
        super("自定义异常，请联系管理员");
        this.code = code;
    }

    public ParamsException(Integer code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    // 枚举类，不用可以删除
    public ParamsException(IResultEnum resultEnum) {
        super(resultEnum.message());
        this.code = resultEnum.status();
        this.message = resultEnum.message();
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public void setmessage(String message) {
        this.message = message;
    }
}
